package com.wing.cabinet.model.response;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wing.cabinet.model.entity.CheckedResultLabel;
import com.wing.cabinet.utils.ExcelExport;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 盘验结果表VO
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class CheckedResultLabelVO {

    /**
     * ID
     */
    private Long id;

    /**
     * 创建时间
     */
    @ExcelExport(value = "盘验时间",sort = 13)
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime createTime;

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 盘验结果id
     */
    private Long resultId;

    /**
     * 盘验结果id
     */
    private Long resultDetailId;

    /**
     * 暂存/回收/维修任务id
     */
    private Long storageInoutId;

    /**
     * 条码
     */
    @ExcelExport(value = "刀具唯一码",sort = 2)
    private String labelCode;

    /**
     * 是否同步
     */
    private Boolean isSync;

    /**
     * 柜子id
     */
    private Long cabId;

    /**
     * sku id
     */
    private Long skuId;

    /**
     * 数量
     */
    @ExcelExport(value = "数量",sort = 10)
    private Integer quantity;

    /**
     * 基础单位数量
     */
    private Integer quantityPack;

    /**
     * 企业id
     */
    private Long companyId;

    /**
     * 操作类型
     */
    private CheckedResultLabel.OperationType operationType;

    /**
    * 操作类型描述
    */
    @TableField(exist = false)
    private String operationTypeDesc;

    public String getOperationTypeDesc() {
        if (operationType!=null){
            return operationType.getDesc();
        }
        return "";
    }

    /**
     * 业务类型
     */
    @ExcelExport(value = "盘验前状态",sort = 14,kv = "temp-暂存;repair-维修;recycle-回收")
    private CheckedResultLabel.BusinessType businessType;

    /**
    * 业务类型描述
    */
    @TableField(exist = false)
    private String businessTypeDesc;

    public String getBusinessTypeDesc() {
        return businessType.getDesc();
    }

    /**
     * 柜子编号
     */
    @ExcelExport(value = "柜子编号",sort = 3)
    private String cabCode;

    /**
     * sku 编号
     */
    @ExcelExport(value = "物料编号",sort = 6)
    private String skuCode;

    /**
     * 货道编号
     */
    @ExcelExport(value = "货位编号",sort = 5)
    private String spaceCode;

    /**
     * operationTypeChecked
     */
    private Integer operationTypeChecked;

    /**
     * 业务类型
     */
    @ExcelExport(value = "盘验后状态",sort = 15,kv = "temp-暂存;repair-维修;recycle-回收")
    private CheckedResultLabel.BusinessTypeChecked businessTypeChecked;

    /**
    * 业务类型描述
    */
    @TableField(exist = false)
    private String businessTypeCheckedDesc;

    public String getBusinessTypeCheckedDesc() {
        return businessTypeChecked == null ? null : businessTypeChecked.getDesc();
    }

    /**
     * quantityCurrentChecked
     */
    private Integer quantityCurrentChecked;

    /**
     * quantityAfterChecked
     */
    private Integer quantityAfterChecked;

    /**
     * repairPrice
     */
    private BigDecimal repairPrice;

    /**
     * 签收数量
     */
    private Integer quantitySign;

    /**
     * 是否已同步：no(0,未同步);yes(1,已同步);
     */
    private Integer isSyns;

    /**
     * 同步时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime synsTime;

    /**
     * 货道id
     */
    private Long spaceId;

    /**
     * quantityChecked
     */
    private Integer quantityChecked;

    /**
     * 货道id
     */

    @ExcelExport(value = "物料名称",sort = 7)
    private String skuName;

    private String skuSpec;

    @ExcelExport(value = "规格码",sort = 8)
    private String skuSpecOld;

    private String skuCodeOld;

    private String skuPic;

    private BigDecimal marketPrice;

    private String productTypeName;

    private String productCategoryName;

    @ExcelExport(value = "品牌",sort = 9)
    private String productBrandName;

    private String unitName;


    @ExcelExport(value = "盘验记录编号",sort = 12)
    private String code;

    /**
     * 企业编码
     */
    private String enterpriseCode;

    @ExcelExport(value = "柜子名称",sort = 4)
    private String cabName;

    private Boolean isCorrect;
    /**
     * 机台
     */
    private String  deviceCode;
    /**
     * 工单id
     */
    private Long workOrderId;
    /**
     * 还刀人
     */
    @ExcelExport(value = "归还人",sort = 11)
    private String inCreatorName;

    /**
     * 明细编号
     */
    @ExcelExport(value = "盘验明细编号",sort = 1)
    private String detailCode;
}
